﻿#ifndef NX_VEHICLE_DESC
#define NX_VEHICLE_DESC

#include "PhysShape.h"
#include "NxVehicleMotorDesc.h"
#include "NxVehicleGearDesc.h"
#include <NxArray.h>
#include <NxShapeDesc.h>

#include "DebugAssert.h"

using namespace NatRacing;

/// 赛车的物理描述类，用于定制不同性能的赛车
class NxVehicleDesc
{
public:

	NxVehicleDesc()	//constructor sets to default
	{
		setToDefault();
	}

	/// 车体的物理形状
	NxArray<Shape_Desc*>	carShapes;

	/// 车轮的物理形状
	/// 车的主要性能都由其决定
	NxArray<Wheel_Desc*>	carWheels;
	NxArray<NxVehicleDesc*> children;

	NxVehicleMotorDesc*		motorDesc;
	NxVehicleGearDesc*		gearDesc;

	NxVec3					position;
	NxReal					mass;
	NxReal					motorForce;
	NxReal					transmissionEfficiency;
	NxReal					differentialRatio;

	NxVec3					steeringTurnPoint;
	NxVec3					steeringSteerPoint;
	NxReal					steeringMaxAngle;

	NxVec3					centerOfMass;

	NxReal					digitalSteeringDelta;

	NxReal					maxVelocity;
	NxReal					cameraDistance;
	//NxReal					digitalSteeringDeltaVelocityModifier;

	void*					userData;


	/// 设置为默认
	void setToDefault();

	/// 检查配置是否可用
	bool isValid() const;

	/// 设置为通用的配置
	/// \param[in] pos 出生地点
	/// \param[in] frontWheelDrive 前轮驱动
	/// \param[in] backWheelDrive 后轮驱动
	/// \param[in] corvette 轻便型
	/// \param[in] monsterTruck 大型
	/// \param[in] oldStyle 老式风格的
	void setCommonUsing(const NxVec3& pos, bool frontWheelDrive, bool backWheelDrive, bool corvette, bool monsterTruck, bool oldStyle);
};

#endif

